//
//  File.swift
//
//
//  Created by didi on 2022/9/14.
//

import Vapor

final class SystemFileCreateDirectoryForm: AbstractForm {
    var name: String!

    init() {
        super.init()
        submit = "Create"
    }

    @FormFieldBuilder
    override func createFields(_ req: Request) -> [FormField] {
        InputField("name")
            .config {
                $0.output.context.label.required = true
            }
            .validators {
                FormFieldValidator.required($1)
            }
            .read { [unowned self] _, field in self.name = field.input }
    }
}
